package c.e.a.c.v;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.FrameLayout;
import b.i.b.f;
import b.i.k.o;
import c.e.a.c.b;
import java.util.WeakHashMap;

/* compiled from: BaseTransientBottomBar */
public class d extends FrameLayout {
    public static final OnTouchListener h = new a();
    public c a;
    public b b;
    public int c;
    public final float d;
    public final float e;
    public ColorStateList f;
    public Mode g;

    /* compiled from: BaseTransientBottomBar */
    public static class a implements OnTouchListener {
        @SuppressLint({"ClickableViewAccessibility"})
        public boolean onTouch(View view, MotionEvent motionEvent) {
            return true;
        }
    }

    public d(Context context, AttributeSet attributeSet) {
        super(c.e.a.c.y.a.a.a(context, attributeSet, 0, 0), attributeSet);
        context = getContext();
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, b.w);
        if (obtainStyledAttributes.hasValue(6)) {
            float dimensionPixelSize = (float) obtainStyledAttributes.getDimensionPixelSize(6, 0);
            WeakHashMap weakHashMap = o.a;
            setElevation(dimensionPixelSize);
        }
        this.c = obtainStyledAttributes.getInt(2, 0);
        this.d = obtainStyledAttributes.getFloat(3, 1.0f);
        setBackgroundTintList(c.e.a.c.a.j(context, obtainStyledAttributes, 4));
        setBackgroundTintMode(c.e.a.c.a.q(obtainStyledAttributes.getInt(5, -1), Mode.SRC_IN));
        this.e = obtainStyledAttributes.getFloat(1, 1.0f);
        obtainStyledAttributes.recycle();
        setOnTouchListener(h);
        setFocusable(true);
        if (getBackground() == null) {
            Drawable k1;
            float dimension = getResources().getDimension(2131165485);
            GradientDrawable gradientDrawable = new GradientDrawable();
            gradientDrawable.setShape(0);
            gradientDrawable.setCornerRadius(dimension);
            gradientDrawable.setColor(c.e.a.c.a.n(c.e.a.c.a.i(this, 2130968791), c.e.a.c.a.i(this, 2130968784), getBackgroundOverlayColorAlpha()));
            if (this.f != null) {
                k1 = f.k1(gradientDrawable);
                k1.setTintList(this.f);
            } else {
                k1 = f.k1(gradientDrawable);
            }
            WeakHashMap weakHashMap2 = o.a;
            setBackground(k1);
        }
    }

    public float getActionTextColorAlpha() {
        return this.e;
    }

    public int getAnimationMode() {
        return this.c;
    }

    public float getBackgroundOverlayColorAlpha() {
        return this.d;
    }

    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        b bVar = this.b;
        if (bVar != null) {
            bVar.onViewAttachedToWindow(this);
        }
        WeakHashMap weakHashMap = o.a;
        requestApplyInsets();
    }

    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        b bVar = this.b;
        if (bVar != null) {
            bVar.onViewDetachedFromWindow(this);
        }
    }

    public void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        c cVar = this.a;
        if (cVar != null) {
            cVar.a(this, i, i2, i3, i4);
        }
    }

    public void setAnimationMode(int i) {
        this.c = i;
    }

    public void setBackground(Drawable drawable) {
        setBackgroundDrawable(drawable);
    }

    public void setBackgroundDrawable(Drawable drawable) {
        if (!(drawable == null || this.f == null)) {
            drawable = f.k1(drawable.mutate());
            drawable.setTintList(this.f);
            drawable.setTintMode(this.g);
        }
        super.setBackgroundDrawable(drawable);
    }

    public void setBackgroundTintList(ColorStateList colorStateList) {
        this.f = colorStateList;
        if (getBackground() != null) {
            Drawable k1 = f.k1(getBackground().mutate());
            k1.setTintList(colorStateList);
            k1.setTintMode(this.g);
            if (k1 != getBackground()) {
                super.setBackgroundDrawable(k1);
            }
        }
    }

    public void setBackgroundTintMode(Mode mode) {
        this.g = mode;
        if (getBackground() != null) {
            Drawable k1 = f.k1(getBackground().mutate());
            k1.setTintMode(mode);
            if (k1 != getBackground()) {
                super.setBackgroundDrawable(k1);
            }
        }
    }

    public void setOnAttachStateChangeListener(b bVar) {
        this.b = bVar;
    }

    public void setOnClickListener(OnClickListener onClickListener) {
        setOnTouchListener(onClickListener != null ? null : h);
        super.setOnClickListener(onClickListener);
    }

    public void setOnLayoutChangeListener(c cVar) {
        this.a = cVar;
    }
}
